package com.example.springevent;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * @author : yx-0176
 * @description
 * @date : 2021/7/9
 */
@Service
public class UserService {

    @Autowired
    private ApplicationContext applicationContext;

    public void register(String user){
        //发布UserRegisterEvent事件
        applicationContext.publishEvent(new UserRegisterEvent(this,user));
    }

}
